package com.chaoyong.higo.adapter;

import com.chaoyong.higo.R;
import com.chaoyong.higo.base.BaseAdapter;
import com.chaoyong.higo.utils.ViewHolder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MyPurchaseAdapter extends BaseAdapter<Object> {

	private String msgs[] = { "夺宝记录", "获得商品", "晒单记录", "我的账户" };
	private int images[] = { R.drawable.me1, R.drawable.me2, R.drawable.me3, R.drawable.me4 };

	private TextView itemName;
	private ImageView itemImag;
	private View itemView;// 间隔作用的view
	private LinearLayout record_layout;//参与记录

	public MyPurchaseAdapter(Context context) {
		super(context);
	}

	@Override
	public int getCount() {
		return msgs.length;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.itme_my_purchase, null);
		}
		itemImag = ViewHolder.get(convertView, R.id.iv_icon1);
		itemName = ViewHolder.get(convertView, R.id.tv_icon1);
		itemView = ViewHolder.get(convertView, R.id.item_view);
		record_layout = ViewHolder.get(convertView, R.id.record_layout);
		
//		if (position == 0) {
//			record_layout.setVisibility(View.VISIBLE);
//		}else {
//			record_layout.setVisibility(View.GONE);
//		}

		if (position == 2) {
			itemView.setVisibility(View.VISIBLE);
		} else {
			itemView.setVisibility(View.GONE);
		}

		itemName.setText(msgs[position]);
		itemImag.setBackgroundResource(images[position]);
		return convertView;
	}

}
